package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.BusinessReportEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter
@Getter
@ToString
public class BusinessReportQueryObject extends QueryObject {
    private String groupType = BusinessReportEnum.BUSINESS.getValue();
    private Long businessId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    private Integer status;
    private Integer appointType;
    public Date getStartTime(){
        //判断日期是否为空
        if (startTime == null){
            return null;
        }
        return DateUtil.endOfDay(startTime);
    }
    public Date getEndTime(){
        //判断日期是否为空
        if (endTime == null){
            return null;
        }
        return DateUtil.endOfDay(endTime);
    }
}
